import 'package:flutter/material.dart';
import 'package:flutter_chat/common/constant/constants.dart';
import 'package:flutter_chat/common/style/styles.dart';
import 'package:flutter_chat/common/widget/widgets.dart';
import 'package:get/get.dart';

class ChatItem extends StatelessWidget {
  const ChatItem({super.key});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        Get.toNamed("${RouterName.chatUser}/2327972001");
      },
      child: Container(
        color: Colors.white,
        child: const ListTile(
          dense: true,
          contentPadding: EdgeInsets.symmetric(
            vertical: 1,
            horizontal: AppTheme.largeSpace,
          ),
          horizontalTitleGap: AppTheme.largeSpace,
          title: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(
                "闲谈",
                overflow: TextOverflow.ellipsis,
                style: TextStyle(
                  fontSize: AppTheme.middleFont,
                  fontWeight: FontWeight.bold,
                ),
              ),
              Text(
                "12:19",
                style: TextStyle(
                  color: AppTheme.infoColor,
                ),
              )
            ],
          ),
          subtitle: Text(
            "[视频]分享一个免费的AI编程小助手",
            overflow: TextOverflow.ellipsis,
            style: TextStyle(
              color: AppTheme.infoColor,
            ),
          ),
          leading: Badge(
            isLabelVisible: true,
            smallSize: 8,
            child: ImageWidget(
              "http://q1.qlogo.cn/g?b=qq&nk=2327972001&s=640",
              size: 45,
              radius: AppTheme.radius,
            ),
          ),
        ),
      ),
    );
  }
}
